package ca.utoronto.utm.csc301.euchre.gamemanager;

import java.util.LinkedHashMap;
import java.util.List;

import ca.utoronto.utm.csc301.euchre.common.Card;
import ca.utoronto.utm.csc301.euchre.common.Suit;
import ca.utoronto.utm.csc301.euchre.player.Player;

/**
 * This interface should be implemented by game manager groups.
 *
 */
public interface GameManager {

	/**
	 * Returns the top card.
	 * 
	 * @return the top card.
	 */
	Card getTopCard();

	/**
	 * Returns the current trump suit. 
	 * 
	 * @return null if we are in the bidding round!
	 */
	Suit getTrumpSuit();

	/**
	 * @return the dealer id
	 */
	int getDealerId();

	/**
	 * 
	 * Return the team mate's id
	 * 
	 * @param player the player
	 * @return the id of player's team mate
	 */
	int getTeamMateId(Player player);
	
	/**
	 * History of the hand so far
	 * 	
	 * @return the list of tricks (a linked map from player id to the card). 
	 */
	List<LinkedHashMap<Integer, Card>> getHistory();
	
	/**
	 * Returns the current cards played.
	 * 
	 * @return a linked map from player id to the card 
	 */
	LinkedHashMap<Integer, Card> getPlayedCards();
	
	/**
	 * The team score of the player
	 * 
	 * @param the player  
	 * @return the score
	 */
	int getTeamScore(Player player);
	
	/**
	 * 
	 * @param players The list of players (players[0] and player[1] are team mates, players[2] and players[3] are team mates)
	 */
	void setPlayers(Player... players);
	
	
	/**
	 * runs the game and returns when the game is finished. 
	 */
	void startGame() throws IllegalPlayException;
	
	/**
	 * History of the game
	 * 	
	 * @return the list of tricks (a linked map from player id to the card). 
	 */
	List<List<LinkedHashMap<Integer, Card>>> getGameHistory();

	/**
	 * 
	 * @return the players id in order of the current hand. [0] is the player on the left of the dealer, ... 
	 */
	int[] getIdsInOrder();
	
}
